package homework;

import org.junit.Test;
import org.w3c.dom.ls.LSOutput;

import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Random;

public class changetest {
    @Test
    public void test01() {
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = i;
        }
        suffer(arr);
        System.out.println(Arrays.toString(arr));
    }
    public void suffer(int[] arr) {
        Random rand = new Random();
        for (int i = arr.length-1;i>0; i--) {
            int j= rand.nextInt(i);
            change(arr,i,j);
        }
    }
    public void change(int[] arr,int i,int j){
        int temp=arr[i];
        arr[i]= arr[j];
        arr[j]=temp;
    }
}